Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
Image Uploaded
Image Uploaded
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } :root { --primary: color-mix(in srgb, red 20%, blueviolet); } body { background-color: #f5f5f5; height: 100vh; display: grid; place-items: center; } input { opacity: 0; width: 0px; } img { max-width: 250px; border-radius: 999px; outline: 2px solid var(--primary); cursor: pointer; transition: 200ms ease-in-out; /* prevents uploaded image from distortion: */ aspect-ratio: 1; object-fit: cover; } img:hover { outline: 8px solid var(--primary); } #toast { visibility: hidden; min-width: 100px; margin-left: -125px; background-color: var(--primary); color: whitesmoke; text-align: center; border-radius: 8px; padding: 12px; position: fixed; z-index: 1; right: 5%; top: 30px; } #toast.show { visibility: visible; -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; animation: fadein 0.5s, fadeout 0.5s 2.5s; } @keyframes fadein { from {top: 0; opacity: 0;} to {top: 30px; opacity: 1;} } @keyframes fadeout { from {top: 30px; opacity: 1;} to {top: 0; opacity: 0;} }
console.log("Event Fired") //Change Image const input = document.getElementById("file-input"); const image = document.getElementById("img-preview"); input.addEventListener("change", (e) => { if (e.target.files.length) { const src = URL.createObjectURL(e.target.files[0]); image.src = src; } }); //Toast: function showToast() { var toast = document.getElementById("toast"); toast.className = "show"; setTimeout(function(){ toast.className = toast.className.replace("show", ""); }, 3000); }